home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 23 / Amiga Format AFCD23 (Feb 1998, Issue 107).iso / -seriously_amiga- / shareware / programming / other / hunk / hoppers / lattice.hop < prev    next >
Text File  |  1997-12-01  |  7KB  |  167 lines

  1. ;*************************************************************************
  2. ;** Lattice                                                             **
  3. ;** Contributor: L.Lucius                               Sept 23rd 1995  **
  4. ;** Modified for HOp:   Thomas Richter  (thor)          Nov  1st  1997  **
  5. ;** Function:    Modify 68000 math routines to use 68020+ instructions. **
  6. ;*************************************************************************
  7.  
  8. ;*************************************************************************
  9. ;
  10. ; DIVS
  11. ;
  12. #match
  13. #code
  14. 48E7 3C00                       ;   MOVEM.L     D2-D5,-(A7)
  15. 2A01                            ;   MOVE.L      D1,D5
  16. 6732                            ;   BEQ.B       003A
  17. 6A02                            ;   BPL.B       000C
  18. 4481                            ;   NEG.L       D1
  19. 2800                            ;   MOVE.L      D0,D4
  20. 6728                            ;   BEQ.B       0038
  21. 6A02                            ;   BPL.B       0014
  22. 4480                            ;   NEG.L       D0
  23. 4282                            ;   CLR.L       D2
  24. 761F                            ;   MOVEQ       #1F,D3
  25. E380                            ;   ASL.L       #1,D0
  26. E392                            ;   ROXL.L      #1,D2
  27. B481                            ;   CMP.L       D1,D2
  28. 6504                            ;   BCS.B       0024
  29. 9481                            ;   SUB.L       D1,D2
  30. 5280                            ;   ADDQ.L      #1,D0
  31. 51CB FFF2                       ;   DBF         D3,0018
  32. 2202                            ;   MOVE.L      D2,D1
  33. B985                            ;   EOR.L       D4,D5
  34. 6A02                            ;   BPL.B       0030
  35. 4480                            ;   NEG.L       D0
  36. B384                            ;   EOR.L       D1,D4
  37. 6A08                            ;   BPL.B       003C
  38. 4481                            ;   NEG.L       D1
  39. 6004                            ;   BRA.B       003C
  40. 4281                            ;   CLR.L       D1
  41. 4280                            ;   CLR.L       D0
  42. 4CDF 003C                       ;   MOVEM.L     (A7)+,D2-D5
  43. 4E75                            ;   RTS
  44. ;
  45. ;
  46. #replace
  47. 4C41 0801                       ;   DIVSL.L     D1,D1:D0
  48. 4E75                            ;   RTS
  49. #end
  50.  
  51.  
  52. ;*************************************************************************
  53. ;
  54. ; DIVU/MODU
  55. ;
  56. #match
  57. #code
  58. 2F02                            ;   MOVE.L      D2,-(A7)
  59. 2F03                            ;   MOVE.L      D3,-(A7)
  60. 4A81                            ;   TST.L       D1
  61. 6722                            ;   BEQ.B       002A
  62. 4A80                            ;   TST.L       D0
  63. 671C                            ;   BEQ.B       0028
  64. 4282                            ;   CLR.L       D2
  65. 761F                            ;   MOVEQ       #1F,D3
  66. E380                            ;   ASL.L       #1,D0
  67. E392                            ;   ROXL.L      #1,D2
  68. B481                            ;   CMP.L       D1,D2
  69. 6508                            ;   BCS.B       0020
  70. 9481                            ;   SUB.L       D1,D2
  71. D0BC 0000 0001                  ;   ADD.L       #00000001,D0
  72. 51CB FFEE                       ;   DBF         D3,0010
  73. 2202                            ;   MOVE.L      D2,D1
  74. 6004                            ;   BRA.B       002C
  75. 4281                            ;   CLR.L       D1
  76. 4280                            ;   CLR.L       D0
  77. 261F                            ;   MOVE.L      (A7)+,D3
  78. 241F                            ;   MOVE.L      (A7)+,D2
  79. 4E75                            ;   RTS
  80. ;
  81. ;
  82. #replace
  83. 4C41 0001                       ;   DIVUL.L     D1,D1:D0
  84. 4E75                            ;   RTS
  85. #end
  86.  
  87.  
  88. ;*************************************************************************
  89. ;
  90. ; MULS
  91. ;
  92. #match
  93. #code
  94. 48E7 7800                       ;   MOVEM.L     D1-D4,-(A7)
  95. 2800                            ;   MOVE.L      D0,D4
  96. B384                            ;   EOR.L       D1,D4
  97. 4A80                            ;   TST.L       D0
  98. 6730                            ;   BEQ.B       003C
  99. 6A02                            ;   BPL.B       0010
  100. 4480                            ;   NEG.L       D0
  101. 2400                            ;   MOVE.L      D0,D2
  102. 4A81                            ;   TST.L       D1
  103. 6604                            ;   BNE.B       001A
  104. 4280                            ;   CLR.L       D0
  105. 6022                            ;   BRA.B       003C
  106. 6A02                            ;   BPL.B       001E
  107. 4481                            ;   NEG.L       D1
  108. 2600                            ;   MOVE.L      D0,D3
  109. C6C1                            ;   MULU.W      D1,D3
  110. 4842                            ;   SWAP        D2
  111. C4C1                            ;   MULU.W      D1,D2
  112. 4842                            ;   SWAP        D2
  113. 4242                            ;   CLR.W       D2
  114. D682                            ;   ADD.L       D2,D3
  115. 4841                            ;   SWAP        D1
  116. C0C1                            ;   MULU.W      D1,D0
  117. 4840                            ;   SWAP        D0
  118. 4240                            ;   CLR.W       D0
  119. D083                            ;   ADD.L       D3,D0
  120. 4A84                            ;   TST.L       D4
  121. 6A02                            ;   BPL.B       003C
  122. 4480                            ;   NEG.L       D0
  123. 4CDF 001E                       ;   MOVEM.L     (A7)+,D1-D4
  124. 4E75                            ;   RTS
  125. ;
  126. ;
  127. #replace
  128. 4C01 0800                       ;   MULS.L      D1,D0
  129. 4E75                            ;   RTS
  130. #end
  131.  
  132.  
  133. ;*************************************************************************
  134. ;
  135. ; MULU
  136. ;
  137. #match
  138. #code
  139. 48E7 7000                       ;   MOVEM.L     D1-D3,-(A7)
  140. 2400                            ;   MOVE.L      D0,D2
  141. 6720                            ;   BEQ.B       0028
  142. 4A81                            ;   TST.L       D1
  143. 6604                            ;   BNE.B       0010
  144. 4280                            ;   CLR.L       D0
  145. 6018                            ;   BRA.B       0028
  146. 2600                            ;   MOVE.L      D0,D3
  147. C6C1                            ;   MULU.W      D1,D3
  148. 4842                            ;   SWAP        D2
  149. C4C1                            ;   MULU.W      D1,D2
  150. 4842                            ;   SWAP        D2
  151. 4242                            ;   CLR.W       D2
  152. D682                            ;   ADD.L       D2,D3
  153. 4841                            ;   SWAP        D1
  154. C0C1                            ;   MULU.W      D1,D0
  155. 4840                            ;   SWAP        D0
  156. 4240                            ;   CLR.W       D0
  157. D083                            ;   ADD.L       D3,D0
  158. 4CDF 000E                       ;   MOVEM.L     (A7)+,D1-D3
  159. 4E75                            ;   RTS
  160. ;
  161. ;
  162. #replace
  163. 4C01 0000                       ;   MULU.L      D1,D0
  164. 4E75                            ;   RTS
  165. #end
  166.  
  167.